package com.example.server8080;

import com.example.server8080.server.GrpcServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class Server8080Application {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(Server8080Application.class, args);
        startRpcServer(run);
    }

    public static void startRpcServer(ApplicationContext ctx) {
        try {
            GrpcServer grpcServer = ctx.getBean(GrpcServer.class);
            grpcServer.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
